import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // 开发和生产切换不同服务器url的方式
    String baseUrl = "release url";
    // 1.利用debug模式保留断言，release去除断言切换url
    assert(() {
      baseUrl = "dev url";
      return true;
    }());

    //2.通过Flutter提供的常量
    if (!kReleaseMode) {
      baseUrl = "dev url";
    }

    // 如果开发中区分dev、release模式的属性很多，可以封装一个Config类，通过InheritedWidget进行共享

    return MaterialApp(
      title: '',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        splashColor: Colors.transparent,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text(''),
        ),
        body: HomePage(),
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container();
  }
}
